/* -------------------------------------------------------------------
 *    Application class for RubiksCube
 *
 *    $File: Cuby.h
 *    $Date: 2013/01/31 $
 *    $Revision: #1 $
 * -------------------------------------------------------------------*/
#ifndef CUBY
#define CUBY

#include <glut.h>
#include <iostream>

//! enum for raotaion axises
enum Axis {X_AXIS = 0, Y_AXIS = 1, Z_AXIS = 2};
//! enum for rotate operation
enum Rotation {CLOCKWISE, COUNTERCLOCKWISE};
//! enum for sidecolors
enum Color {BLACK = 0, WHITE = 1, YELLOW = 2, RED = 3, ORANGE = 4, BLUE = 5, GREEN = 6};

//! Cuby is the basic class for building a rubiks cube
class Cuby
{
private:
	//! orientation of cubie in wks, one of 24 possible states
	int orientation;
	//! color pattern, respecting inner sides with materialcolor (mostly black)
	int* sidecolors;
	//! int[] containing rotation for x,y,z-axis
	int* rotation;
	//! getRotation, depending on orientation state
	int* lookupGLRotation(void);
	//! mappings for x-axis clockwise transitions 
	static const int xMapping[];
	//! mappings for y-axis clockwise transitions 
	static const int yMapping[];
	//! mappings for z-axis clockwise transitions 
	static const int zMapping[];

public:
	//! default ctor
	Cuby(void);
	//! rotate cuby arround X-axis
	void rotateX(Rotation rot);
	//! rotate cuby arround Y-axis
	void rotateY(Rotation rot);
	//! rotate cuby arround Z-axis
	void rotateZ(Rotation rot);
	//! reset orentation to default alignment
	void resetOrientation(void);
	//! getter for orientation
	int getOrientation(void) const;
	//! set orientation
	void setOrientation(int* orient);
	//! getter for sidecolors
	int* getSidecolors(void) const;
	//! setter for sidecolors
	void setSidecolors(int* colors);
	//! draws "glutSolidCube-clone" with different colored faces
	void draw(GLfloat size = 1.0f);
};

#endif